1. Set up analysis with ArchR and ArchRWire

### Load libraries

library(magrittr)
library(ArchR)
library(ggpubr)
library(purrr)
library(devtools)
### Set ArchR parameters.
addArchRThreads(threads = 15) # number of parallel threads
addArchRGenome('hg38') # genome and gene annotation ('hg19', 'hg38', 'mm9', 'mm10')


a) Install ArchRWire

setwd('/media/ag-rippe/isabelle/ArchRWire_dev')
with_libpaths(new = "/path/to/your/R4.0.2_libs", install('ArchRWire'))
library(ArchRWire, lib.loc = "/path/to/your/R4.0.2_libs")




2. Load ArchRProject

overview
### Define parameters for analysis
conditions <- c('HUVEC_0min', 'HUVEC_TNFa_30min', 'HUVEC_TNFa_240min', 'HUVEC_TGFb_30min', 'HUVEC_TGFb_240min')
pal <- c('HUVEC_0min' = '#9E9E9E', 'HUVEC_TNFa_30min' = '#03D000', 'HUVEC_TNFa_240min' = '#027A00', 'HUVEC_TGFb_30min' = '#FFA91F', 'HUVEC_TGFb_240min' = '#CC7E00')
### Load ArchRProject
proj <- loadArchRProject('/media/ag-rippe/markus_side_projects/scATAC_HUVEC_TNFa_TGFb/analysis/isabelle/scATAC_10xGenomics/4_archr/ArchRProject_1_basics')
proj # Exemplary ArchRProject contains 5 samples.
           ___      .______        ______  __    __  .______      
          /   \     |   _  \      /      ||  |  |  | |   _  \     
         /  ^  \    |  |_)  |    |  ,----'|  |__|  | |  |_)  |    
        /  /_\  \   |      /     |  |     |   __   | |      /     
       /  _____  \  |  |\  \\___ |  `----.|  |  |  | |  |\  \\___.
      /__/     \__\ | _| `._____| \______||__|  |__| | _| `._____|
    

class: ArchRProject 
outputDirectory: /media/ag-rippe/markus_side_projects/scATAC_HUVEC_TNFa_TGFb/analysis/isabelle/scATAC_10xGenomics/4_archr/ArchRProject_1_basics 
samples(5): HUVEC_0min HUVEC_TNFa_30min HUVEC_TNFa_240min
  HUVEC_TGFb_30min HUVEC_TGFb_240min
sampleColData names(1): ArrowFiles
cellColData names(15): Sample TSSEnrichment ... DoubletEnrichment
  BlacklistRatio
numberOfCells(1): 23773
medianTSS(1): 9.694
medianFrags(1): 27104
proj@reducedDims # 7 iterative LSI reduced dimension objects are present.
List of length 7
names(7): IterativeLSI_25000varFeatures ... IterativeLSI_50000varFeatures
proj@embeddings # 7 single-cell UMAP embeddings are present.
List of length 7
names(7): UMAP_25000varFeatures ... UMAP_50000varFeatures




3. Cell QC

overview
options(repr.plot.width=40, repr.plot.height=10)
p <- lapply(conditions, function(sample){plotCellQuality(proj, sample, 3.9)})
ggAlignPlots(plotList=p, type = "h")




4. Visualization as UMAP

overview

a) Visualize QC parameters on single-cell embedding

umapQC <- plotUmapQC(ArchRProj = proj, # ArchRProj is mandatory
                     embedding = 'UMAP_25000varFeatures', # specify embedding to use (optional, defaults to first object in ArchRProj's embedding list)
                     coloringLayer = "Sample", # specify cellColData column to use as comparative coloring layer of single cells (optional, defaults to 'Sample' column)
                     title = 'QC parameters of single cells', # optional
                     coloringPalette = pal) # optionally specify colors for reference coloring of single cells
ggpubr::ggarrange(plotlist=umapQC, ncol=3, nrow=2)


b) Visualize multiple single-cell embeddings

umaps <- plotUmaps(proj, # ArchRProj is mandatory
                   embeddings = names(proj@embeddings[1:3]), # specify embeddings to use (optional, defaults to all objects in ArchRProj's embedding list)
                   coloringLayer = "Sample", # specify cellColData column to use as comparative coloring layer of single cells (optional, defaults to 'Sample' column)
                   coloringPalette = pal) # optionally specify colors for coloring of single cells
ggpubr::ggarrange(plotlist=umaps, ncol=3, nrow=1)


c) Visualize groups of single cells in different plots (UMAP splits)

umapSplit <- plotUmapSplit(proj, # ArchRProj is mandatory
                           embedding = 'UMAP_25000varFeatures', # specify embedding to use (optional, defaults to first object in ArchRProj's embedding list)
                           splitLayer = 'Sample', # specify cellColData column to use as split layer of single cells (optional, defaults to 'Sample' column)
                           selectLevels = conditions, # specify certain levels of split layer to visualize (optional, defaults to all levels in cellColData 'Sample' column)
                           coloringPalette = pal) # optionally specify colors for coloring of single cells
ggpubr::ggarrange(plotlist=umapSplit, ncol=3, nrow=2)


d) Visualize clustering of single cells

umapClusters <- plotUmapClusters(proj, # ArchRProj is mandatory
                                 embedding = 'UMAP_25000varFeatures', # specify embedding to use (optional, defaults to first object in ArchRProj's embedding list)
                                 reducedDims = 'IterativeLSI_25000varFeatures') # specify reduced dimensions to use (optional defaults to first object in ArchRProj's reduced dimensions list)
ggpubr::ggarrange(plotlist=umapClusters, ncol=3, nrow=1)

Visualization with ArchRWire (02.03.2021 | v0.2.01)
i.lander@dkfz-heidelberg.de
Division of Chromatin Networks, DKFZ